<!DOCTYPE HTML>
<!--
	Dimension by HTML5 UP
	html5up.net | @ajlkn
	Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
 <head>
  <title>
   Dimension by HTML5 UP
  </title>
  <!-- <meta charset="utf-8" /> -->
  <!-- <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" /> -->
  <meta charset="utf-8"/>
  <meta content="width=device-width,initial-scale=1.0" name="viewport"/>
  <link href="../../assets/css/article.css" rel="stylesheet"/>
  <link href="https://cdn.bootcss.com/highlight.js/9.15.8/styles/github.min.css" rel="stylesheet"/>
  <noscript>
   <link href="../../assets/css/noscript.css" rel="stylesheet"/>
  </noscript>
 </head>
 <body>
  <div id="app">
  </div>
  <!-- built files will be auto injected -->
 </body>
 <body class="is-preload">
  <!-- Wrapper -->
  <div id="wrapper">
   <!-- Main -->
   <div id="main">
    <article id="article">
     <h1 id="linux">
      Linux 时间校准
     </h1>
     <hr/>
     <h2 id="_1">
      命令
     </h2>
     <h3 id="_2">
      方式一
     </h3>
     <div class="codehilite">
      <pre><span></span><code><span class="n">tzselect</span>
<span class="n">export</span> <span class="n">TZ</span><span class="o">=</span><span class="s1">'Asia/Shanghai'</span>
<span class="k">source</span> <span class="o">~/</span><span class="p">.</span><span class="n">bashrc</span>
<span class="n">rm</span> <span class="o">-</span><span class="n">f</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="k">localtime</span>
<span class="n">ln</span> <span class="o">-</span><span class="n">s</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="k">share</span><span class="o">/</span><span class="n">zoneinfo</span><span class="o">/</span><span class="n">Asia</span><span class="o">/</span><span class="n">Shanghai</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="k">localtime</span>
<span class="n">timedatectl</span> <span class="k">set</span><span class="o">-</span><span class="n">timezone</span> <span class="s1">'Asia/Shanghai'</span>

<span class="n">yum</span> <span class="o">-</span><span class="n">y</span> <span class="n">install</span> <span class="n">ntp</span>
<span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">sbin</span><span class="o">/</span><span class="n">ntpdate</span> <span class="o">-</span><span class="n">u</span> <span class="n">cn</span><span class="p">.</span><span class="n">pool</span><span class="p">.</span><span class="n">ntp</span><span class="p">.</span><span class="n">org</span>
</code></pre>
     </div>
     <h3 id="_3">
      方式二
     </h3>
     <p>
      ```shell script
date
     </p>
     <p>
      yum install -y ntpdate
rm -rf /etc/localtime
cp /usr/share/zoneinfo/Asia/Shanghai/ /etc/localtime
ntpdate -u ntp.api.bz
date
hwclock -w
```
     </p>
     <h2 id="_4">
      参考链接
     </h2>
     <ul>
      <li>
       <a href="https://blog.csdn.net/zisefeizhu/article/details/81535299">
        Linux服务器时间不一致问题的解决
       </a>
      </li>
      <li>
       <a href="https://blog.csdn.net/wangbailin2009/article/details/53332453">
        linux 修改服务器时间
       </a>
      </li>
      <li>
       <a href="https://www.myfreax.com/how-to-set-or-change-timezone-on-centos-7/">
        如何在CentOS 7上设置或更改时区
       </a>
      </li>
      <li>
       <a href="https://blog.51cto.com/u_1472521/3714709">
        Docker时间不一致，时区设置
       </a>
      </li>
      <li>
       <a href="https://zhuanlan.zhihu.com/p/345402656">
        docker时区的修改与同步
       </a>
      </li>
     </ul>
    </article>
   </div>
   <!-- Footer -->
   <footer id="footer">
    <p class="copyright">
     © Untitled. Design:
     <a href="https://html5up.net">
      HTML5 UP
     </a>
     .
    </p>
   </footer>
  </div>
  <!-- BG -->
  <div id="bg">
  </div>
  <!-- Scripts -->
  <script src="../assets/js/jquery.min.js">
  </script>
  <script src="../assets/js/browser.min.js">
  </script>
  <script src="../assets/js/breakpoints.min.js">
  </script>
  <script src="../assets/js/util.js">
  </script>
  <script src="../assets/js/main.js">
  </script>
 </body>
</html>
